﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;

public partial class ucControl_ucMain : System.Web.UI.UserControl
{
    TblSupplierDAO supplierDAO = new TblSupplierDAO(Global.CONNECTION_STRING);
    TblItemsDAO itemDAO = new TblItemsDAO(Global.CONNECTION_STRING);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadImageSupp();
            LoadItem();

        }
    }

    private void LoadImageSupp()
    {
        lvItems.DataSource = supplierDAO.GetAll();
        lvItems.DataBind();
    }
    private void LoadItem()
    {
        lvItemSP.DataSource = itemDAO.GetSPNoiBat();
        lvItemSP.DataBind();
    }
    protected void btnChiTiet_Click(object sender, ImageClickEventArgs e)
    {
        int id = Convert.ToInt32(((ImageButton)sender).CommandArgument);
        Response.Redirect("~/ChiTietSanPham.aspx?id=" + id);
    }
}
